<?php
/*
7.2.3 Books
Metódy:
•	ListAll() – vráti všetky knihy
*/

class Books_model extends CI_Model{

    public function __construct(){
        $this->load->database();
    }

    public function listAll(){
        return $this->db->get('books');
    }

    public function dummy_fill(){
        $dummy_books = array(
            array(
                'name' => 'prvy',
                'year' => '1'
            ),
            array(
                'name' => 'druhy',
                'year' => '2'
            ),
            array(
                'name' => 'treti',
                'year' => '3'
            ),
            array(
                'name' => 'stvrty',
                'year' => '4'
            ),
            array(
                'name' => 'piaty',
                'year' => '5'
            )
        );
        $this->db->insert_batch('books',$dummy_books);
    }
}

?>